package gat.common.util;

import com.bitsun.core.common.exception.AppException;
import com.bitsun.core.common.exception.ErrorCode;

import gat.common.exception.ExceptionEnum;

public class ExceptionUtil {

    public static void throwNew(ExceptionEnum e) {
        throwNew(e.getCode(), e.getMsg());
    }

    public static void throwNew(ExceptionEnum e, String msg) {
        throwNew(e.getCode(), e.getMsg() + ", " + msg);
    }

    public static void throwNew(String code, String msg) {
        throw new AppException(msg, ErrorCode.tc(code));
    }

    public static AppException createException(ExceptionEnum e) {
        return new AppException(e.getMsg(), ErrorCode.tc(e.getCode()));
    }
}
